home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / ada / gnat-3.05- / gnat-3 / gnat-3.05-i486-linux-elf-bin / rts / i-os2lib.ads < prev    next >
Encoding:
Text File  |  1996-06-07  |  5.7 KB  |  128 lines

  1. ------------------------------------------------------------------------------
  2. --                                                                          --
  3. --                         GNAT COMPILER COMPONENTS                         --
  4. --                                                                          --
  5. --                     I N T E R F A C E S . O S 2 L I B                    --
  6. --                                                                          --
  7. --                                  S p e c                                 --
  8. --                                                                          --
  9. --                             $Revision: 1.11 $                            --
  10. --                                                                          --
  11. --     Copyright (C) 1993,1994,1995,1996 Free Software Foundation, Inc.     --
  12. --                                                                          --
  13. -- GNAT is free software;  you can  redistribute it  and/or modify it under --
  14. -- terms of the  GNU General Public License as published  by the Free Soft- --
  15. -- ware  Foundation;  either version 2,  or (at your option) any later ver- --
  16. -- sion.  GNAT is distributed in the hope that it will be useful, but WITH- --
  17. -- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
  18. -- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
  19. -- for  more details.  You should have  received  a copy of the GNU General --
  20. -- Public License  distributed with GNAT;  see file COPYING.  If not, write --
  21. -- to  the Free Software Foundation,  59 Temple Place - Suite 330,  Boston, --
  22. -- MA 02111-1307, USA.                                                      --
  23. --                                                                          --
  24. -- As a special exception,  if other files  instantiate  generics from this --
  25. -- unit, or you link  this unit with other files  to produce an executable, --
  26. -- this  unit  does not  by itself cause  the resulting  executable  to  be --
  27. -- covered  by the  GNU  General  Public  License.  This exception does not --
  28. -- however invalidate  any other reasons why  the executable file  might be --
  29. -- covered by the  GNU Public License.                                      --
  30. --                                                                          --
  31. -- GNAT was originally developed  by the GNAT team at  New York University. --
  32. -- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
  33. --                                                                          --
  34. ------------------------------------------------------------------------------
  35.  
  36. --  This package (and children) provide interface definitions to the standard
  37. --  OS/2 Library. They are merely a translation of the various <bse*.h> files.
  38.  
  39. --  It is intended that higher level interfaces (with better names, and
  40. --  stronger typing!) be built on top of this one for Ada (i.e. clean)
  41. --  programming.
  42.  
  43. --  We have chosen to keep names, types, etc.  as close as possible to the
  44. --  C definition to provide easier reference to the documentation. The main
  45. --  exception is when a formal and its type (in C) differed only by the case
  46. --  of letters (like in HMUX hmux). In this case, we have prepended "F_" to
  47. --  the formal (i.e. F_hmux : HMUX).
  48.  
  49. with Interfaces.C;
  50. with Interfaces.C.Strings;
  51. with System;
  52.  
  53. package Interfaces.OS2Lib is
  54. pragma Preelaborate (OS2Lib);
  55.  
  56.    package IC  renames Interfaces.C;
  57.    package ICS renames Interfaces.C.Strings;
  58.  
  59.    -------------------
  60.    -- General Types --
  61.    -------------------
  62.  
  63.    type    APIRET   is new IC.unsigned_long;
  64.    type    APIRET16 is new IC.unsigned_short;
  65.    subtype APIRET32 is     APIRET;
  66.  
  67.    subtype PSZ   is ICS.chars_ptr;
  68.    subtype PCHAR is ICS.chars_ptr;
  69.    subtype PVOID is System.Address;
  70.  
  71.    type BOOL32 is new IC.unsigned_long;
  72.    False32 : constant BOOL32 := 0;
  73.    True32  : constant BOOL32 := 1;
  74.  
  75.    type UCHAR  is new IC.unsigned_char;
  76.    type USHORT is new IC.unsigned_short;
  77.    type ULONG  is new IC.unsigned_long;
  78.    type PULONG is access all ULONG;
  79.  
  80.    ---------------------
  81.    -- Time Manegement --
  82.    ---------------------
  83.  
  84.    procedure DosSleep (How_long : IC.int);
  85.    pragma Import (C, DosSleep, External_Name => "DosSleep");
  86.  
  87.    type DATETIME is
  88.       record
  89.            hours      : UCHAR;
  90.            minutes    : UCHAR;
  91.            seconds    : UCHAR;
  92.            hundredths : UCHAR;
  93.            day        : UCHAR;
  94.            month      : UCHAR;
  95.            year       : USHORT;
  96.            timezone   : IC.short;
  97.            weekday    : UCHAR;
  98.       end record;
  99.  
  100.    type PDATETIME is access all DATETIME;
  101.  
  102.    function DosGetDateTime (pdt : PDATETIME) return APIRET;
  103.    pragma Import (C, DosGetDateTime, External_Name => "DosGetDateTime");
  104.  
  105.    function DosSetDateTime (pdt : PDATETIME) return APIRET;
  106.    pragma Import (C, DosSetDateTime, External_Name => "DosSetDateTime");
  107.  
  108.    ----------------------------
  109.    -- Miscelleneous Features --
  110.    ----------------------------
  111.  
  112.    --  Features which do not fit any child
  113.  
  114.    function DosBeep (Freq : ULONG; Dur : ULONG) return APIRET;
  115.    pragma Import (C, DosBeep, External_Name => "DosBeep");
  116.  
  117.    procedure Must_Not_Fail (Return_Code : OS2Lib.APIRET);
  118.    --  Many OS/2 functions return APIRET and are not supposed to fail. In C
  119.    --  style, these would be called as procedures, disregarding the returned
  120.    --  value. This procedure can be used to achieve the same effect with a
  121.    --  call of the form: Must_Not_Fail (Some_OS2_Function (...));
  122.  
  123.    procedure Sem_Must_Not_Fail (Return_Code : OS2Lib.APIRET);
  124.    --  Similar to Must_Not_Fail, but used in the case of DosPostEventSem,
  125.    --  where the "error" code ERROR_ALREADY_POSTED is not really an error.
  126.  
  127. end Interfaces.OS2Lib;
  128.